All the code can be found on github repository, specifically on the folder: codes
Codes still need refactoring!
import matplotlib.pyplot as plt
from misc_tools import Plotter, Smoother
from run import Run
plt.rcdefaults()
# Image Directory
IMAGE_DIRECTORY = "../data/images1"
DATA_DIRECTORY = "../data/results"
r = Run(IMAGE_DIRECTORY, DATA_DIRECTORY)
# Strating Crop coordinates
crop_1 = (150, 40, 40, 40)
crop_2 = (120, 250, 50, 50)
crop_3 = (250, 230, 40, 40)
# Image Positions
positions_1 = (0, 70)
positions_2 = (75, 100)
positions_3 = (106, 155)
df_dc = r.dynamic_cropping(
crop_1,
crop_2,
crop_3,
positions_1,
positions_2,
positions_3,
save=True, #Saving the generated DataFrame
file_name="dc",
plot=False, #whether to plot
strict=True, #Using the equation of line
crop_included=False, #Excluding the crop coordinates
)
p = Plotter(df= r"C:\Users\harik\Desktop\mini-project\data\results\centers_using_dc.csv", save_path = DATA_DIRECTORY)
p.get_samples(len_samples = 25,
file_name="using_dc", title="Using DC")
#Smoothing the data
s = Smoother(df=r"C:\Users\harik\Desktop\mini-project\data\results\centers_using_dc.csv")
df_dc = s.smoothen()
df_dc
cols = ["x", "y"]
p.plot_all(title="x, y using Dynamical Cropping", cols = cols, smooth=False, file_name="x_y_using_dc.png")
There are some missing values between the timestamps 60 and 80.
cols = ["vx", "vy"]
p.plot_all(title="x, y using Dynamical Cropping", cols = cols, smooth=True)
cols = ["r1", "r2"]
p.plot_all(title="r1, r2 and r using Dynamical Cropping", cols = cols)
df_si = r.subtracting_images(subtract=True, strict=False,
plot=False)
There are about a dozen of images where the method is not working.
p = Plotter(df= r"C:\Users\harik\Desktop\mini-project\data\results\centers_using_si.csv", save_path = DATA_DIRECTORY)
# p.get_samples(len_samples = 25,
# file_name="using_si", title="Using SI")
#Smoothing the data
s = Smoother(df=r"C:\Users\harik\Desktop\mini-project\data\results\centers_using_si.csv")
df_si = s.smoothen()
df_si
cols = ["x", "y"]
p.plot_all(title="x, y using Subtracting Images", cols = cols, smooth=False, file_name="x_y_using_si.png")
cols = ["vx", "vy"]
p.plot_all(title="vx, vy using Subtracting Images", cols = cols)
cols = ["r1", "r2"]
p.plot_all(title="r1, vy using Subtracting Images", cols = cols)
df_ap = r.all_points(plot=False, crop_included=True)
Again, there are about a dozen of images where the method is not working.
p = Plotter(df= r"C:\Users\harik\Desktop\mini-project\data\results\centers_using_ap.csv", save_path = DATA_DIRECTORY)
# p.get_samples(len_samples = 25,
# file_name="using_ap", title="Fitting Ellipse")
#Smoothing the data
s = Smoother(df=r"C:\Users\harik\Desktop\mini-project\data\results\centers_using_ap.csv")
df_ap = s.smoothen()
df_ap
cols = ["x", "y"]
p.plot_all(title="x, y using Fitting Ellipse", cols = cols, smooth=False, file_name="x_y_using_ap.png")
cols = ["vx", "vy"]
p.plot_all(title="vx, vy using Subtracting Images", cols = cols)
cols = ["r1", "r2"]
p.plot_all(title="r1, r2 using Subtracting Images", cols = cols)
p.plot_one("v")
p.plot_one("r")
p.plot_one("theta")
# Image Directory
import matplotlib.pyplot as plt
from misc_tools import Plotter, Smoother
from run import Run
plt.rcdefaults()
IMAGE_DIRECTORY = "../data/images1"
DATA_DIRECTORY = "../data/results"
r = Run(IMAGE_DIRECTORY, DATA_DIRECTORY)
df_ap = r.all_points(plot=False, file_name="convolution", crop_included=True, min_array_value=110, kernel="gaussian_y")
p = Plotter(df= r"C:\Users\harik\Desktop\mini-project\data\results\convolution.csv", save_path = DATA_DIRECTORY)
# p = Plotter(df= r"C:\Users\harik\Desktop\mini-project\data\results\new.csv", save_path = DATA_DIRECTORY)
p.get_samples(len_samples = 49, title="Fitting Ellipse with convolution", file_name="convolution")
cols = ["x", "y"]
p.plot_all(title="x, y using Fitting Ellipse with convolution", cols = cols, smooth=False, scatter=True)
cols = ["theta"]
p.plot_one(title="theta using Fitting Ellipse with convolution", col1="theta", smooth=True)